package controller;

import common.util.PageBean;
import model.dto.RegistryDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import service.RegisterInfoListService;

/**
 * @className: controller.RegisterInfoListController
 * @author: Xia
 * @create: 2023-03-18 11:24
 */
@Controller
@RequestMapping("/api/register")
public class RegisterInfoListController {
    @Autowired
    private RegisterInfoListService service;

    @RequestMapping("registerInfoList")
    public String toRegisterInfoList(String patientIdCard, String doctorName, Integer status,
                                     @RequestParam(name = "pageNo",defaultValue = "1") Integer index, Model model){
        PageBean<RegistryDto> page = service.page(patientIdCard, doctorName, status, index);
        model.addAttribute("pages",page);
        model.addAttribute("queryIdCard",patientIdCard);
        model.addAttribute("queryDoctorId",doctorName);
        model.addAttribute("queryStatus",status);
        return "registerInfoList";
    }
}
